<template>
  <div v-if="type">这是type1</div>
  <div v-if="!type">这是type2</div>
  <a-input v-model:value="inputVal"></a-input>
</template>
<script setup>
import { watch, ref } from 'vue'
const props = defineProps({
  type: {
    type: Boolean,
    default: false
  }
})
const type = ref()
const inputVal = ref()
function setProps () {
  type.value = props.type
}
setProps()
watch(() => props, () => { setProps() }, { deep: true })

const getValue = () => {
  return inputVal.value
}
defineExpose({ getValue })
</script>